package com.pay.game.central.web.controller;

import com.github.pagehelper.Page;
import com.github.pagehelper.PageInfo;
import com.pay.game.central.common.Result;
import com.pay.game.central.common.ResultGenerator;
import com.pay.game.central.security.annotaion.UserLoginToken;
import com.pay.game.central.web.bean.Settlement;
import com.pay.game.central.web.service.SettlementService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RequestMapping("settlement")
@RestController
public class SettlementController {

    @Autowired
    private SettlementService settlementService;

    @GetMapping("/user/{rootUserId}")
    @UserLoginToken
    @ResponseBody
    Result<PageInfo<Settlement>> list(@PathVariable String rootUserId,
                                      boolean showDescendant,
                                      String storeId,
                                      String storeName,
                                      String startDate,
                                      String endDate){
        Page<Settlement> page = settlementService.list(rootUserId, showDescendant, storeId, storeName, startDate, endDate);
        return ResultGenerator.genSuccessResult(new PageInfo<>(page));
    }

}
